﻿namespace SW.Lite.Infrastructure.Common
{
    /// <summary>
    ///     Class ExecuteResult.
    /// </summary>
    public class ExecuteResult<T>
    {
        /// <summary>
        ///     Gets or sets the key.
        /// </summary>
        /// <value>The key.</value>
        public T Key { get; set; }

        /// <summary>
        ///     Gets or sets a value indicating whether this <see cref="ExecuteResult{T}" /> is result.
        /// </summary>
        /// <value><c>true</c> if result; otherwise, <c>false</c>.</value>
        public bool Result { get; set; }

        /// <summary>
        ///     Gets or sets the data.
        /// </summary>
        /// <value>The data.</value>
        public object Data { get; set; }

        /// <summary>
        ///     Gets or sets the message.
        /// </summary>
        /// <value>The message.</value>
        public string Message { get; set; }

        public static implicit operator bool(ExecuteResult<T> result)
        {
            return result.Result;
        }
    }
}